extends Node2D


# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var _text = ''
var _num0 = 1
var _num1 = 1

signal page_changed

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

func setTips(text, v0, v1):
	var title = text + '({v0}/{v1})'
	get_node("tips").text = title.format({
		"v0": v0,
		"v1": v1
	})
	_text = text
	_num0 = v0
	_num1 = v1
	emit_signal("page_changed", _num0)
	pass

func _on_prev_pressed():
	if _num0 - 1 == 0:
		return
	_num0 -= 1
	setTips(_text, _num0, _num1)
	pass # Replace with function body.

func _on_next_pressed():
	if _num0 + 1 > _num1:
		return
	_num0 += 1
	setTips(_text, _num0, _num1)
	pass # Replace with function body.
